/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package anjos.modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Junior
 */
@Entity
@Table(name = "anjo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Anjo.findAll", query = "SELECT a FROM Anjo a"),
    @NamedQuery(name = "Anjo.findById", query = "SELECT a FROM Anjo a WHERE a.id = :id"),
    @NamedQuery(name = "Anjo.findByApelido", query = "SELECT a FROM Anjo a WHERE a.apelido = :apelido"),
    @NamedQuery(name = "Anjo.findByNome", query = "SELECT a FROM Anjo a WHERE a.nome = :nome"),
    @NamedQuery(name = "Anjo.findByRg", query = "SELECT a FROM Anjo a WHERE a.rg = :rg"),
    @NamedQuery(name = "Anjo.findByTelefone", query = "SELECT a FROM Anjo a WHERE a.telefone = :telefone"),
    @NamedQuery(name = "Anjo.findByEmail", query = "SELECT a FROM Anjo a WHERE a.email = :email")})
public class Anjo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Size(max = 20)
    @Column(name = "apelido")
    private String apelido;
    @Size(max = 100)
    @Column(name = "nome")
    private String nome;
    @Size(max = 20)
    @Column(name = "rg")
    private String rg;
    @Size(max = 10)
    @Column(name = "telefone")
    private String telefone;
    @Column(name = "email")
    private String email;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "anjo")
    private List<AnjoEvento> anjoEventoList;

    public Anjo() {
    }

    public Anjo(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getApelido() {
        return apelido;
    }

    public void setApelido(String apelido) {
        this.apelido = apelido;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getRg() {
        return rg;
    }

    public void setRg(String rg) {
        this.rg = rg;
    }

    public String getTelefone() {
        return telefone;
    }

    public void setTelefone(String telefone) {
        this.telefone = telefone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @XmlTransient
    public List<AnjoEvento> getAnjoEventoList() {
        return anjoEventoList;
    }

    public void setAnjoEventoList(List<AnjoEvento> anjoEventoList) {
        this.anjoEventoList = anjoEventoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Anjo)) {
            return false;
        }
        Anjo other = (Anjo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "anjos.modelo.Anjo[ id=" + id + " ]";
    }
    
}
